|
|
Web Server page compression tips
Webserver Tips by Donald Burleson |
Bandwidth is very
expensive on busy web sites and there are many things that your
webmaster can do to reduce your bandwidth and also improve your
web page deliver speed. Web sites without caching or
compression have have huge delays because of over-stressed disks
(enqueues for frequently-referenced pages and images) and there
are two main ways to fix this, web page/image caching and HTML
compression. For my notes on RAM caching of web pages, see
my webserver RAM
caching tips.
What tools do HTML
Compression?
This
web site
has a great list of many HTML compression tools:
-
HTML
Compact - Replaces straight HTML tokenized JavaScript
and a small decompressor, for JavaScript-enabled browsers.
From AntsSoft.
-
mod_deflate - Included in the Apache 2.0 distribution.
-
mod_gzip - If you really need fine-tuning and advanced
statistics, use mod_gzip instead. Currently an open source
SourceForge project.
-
mod_hs - The Commercial Version of mod_gzip created by
HyperSpace, Communications, Inc. HyperSpace claims a 30
percent performance increase achieved by in-memory
compression and elimination of disk I/O operations.
-
mod_deflate ru (in Russian) - If you need fine-tuning
and the best possible performance, try mod_deflate from
sysoev.ru. See also
documentation and
mod_deflate ru tarball.
-
gzip_cnc
Let's take a look at
the two most common HTML compression software tools, both within
Apache.
Using
Apache for HTML compression
You can utilize idle
CPU resources by installing
HTTP compression to improve webserver HTML delivery speed,
trading off unused CPU cycles for faster web response time.
The two most popular HTML compression tools include:
-
mod_gzip -
Available on Apache 1.3, mod gzip compresses all outgoing
HTML and the browser uncompresses the HTML at rendering
time.
-
mod_deflate
- A newer tool, mod_deflate is available on Apache 2.0.
Mod_deflate is also available for Apache 1.3 on this
Russian web site.
The only problem with
HTML compression is that it does take a extra CPU resources, so
it is a direct tradeoff between CPU and bandwidth resources.
Using mod_gzip
Older web site (using
Apache 1.3) can benefit from HTML page compression with the
Apache mod_gzip module. It
says here that mod_gzip has a fantastic HTML compression
routine that works great with Apache 1.3. The 30%-60% bandwidth
reduction makes me wonder why every web host is not using it:
"Webmasters
typically see a 150-160% increase in Web server performance,
and a 70% - 80% reduction in HTML/XML/JavaScript bandwidth
utilized, using this module. Overall the bandwidth savings
are approximately 30 to 60%. (This factors in the
transmission of graphics.)"
Using mod_deflate
Mod_Deflate is available with later Apache releases (Apache
2) and it will compress whichever type of code you want once it
is delivered to the client, and can save up to 80% on some
pages.
On shared
web servers, mod_deflate can be installed to only work for
specific domains, so your ISP should be able to provide HTML
compression just for your web sites.
If you running Apache 1.3, there
are still ways to employ mod_deflate and also get web caching on
Apache 1.3. This Russian
web site notes such a product.
"mod_deflate is
described in a recently published book by Andy King, "Speed
Up Your Site: Web Site Optimization" in "
Chapter 18: Compressing the Web" written by Konstantin
Balashov.
Both modules have been in use on several heavily loaded
Russian sites for more than 2 years. There are some English
links:
www.fastmail.fm success story by Jeremy Howard and the
installation example by
Philip Mak. "
In matters relating to
HTTP compression, see my notes on
Real-time web server traffic monitors - Live statistics,
Webserver Traffic
Monitoring Tips. I have also prepared notes on the
best
webserver hardware configuration, and
webserver RAM caching
tips.